import instance from './index';
import qs from 'qs';

const preUrlPath = '';
//登录
const requestLogin = {
/*  let words = CryptoJS.enc.Utf8.parse(params.password);
  let base64 = CryptoJS.enc.Base64.stringify(words);
  params.password = base64;*/
  // return axios.get(`http://rap2api.taobao.org/app/mock/224/GET/web`, {params})

   r: params => {
    return instance.post(`/auth/login`, qs.stringify(params),{ headers:{'Content-Type':'application/x-www-form-urlencoded'}})
  // return axios.get(`http://rap2api.taobao.org/app/mock/224/GET/web`, {params})
    
  }
};
//获取用户列表
const request = {
  p: ['get,/roles'],
  r: params => {
    return instance.post(`${preUrlPath}/user/fetchPageList`, {params})
  }
};
//删除角色
const remove = {
  p: ['delete,/role/**'],
  r: params => {
    return instance.get(`${preUrlPath}/role/${params.id}`)
  }
};
//越权请求
const notAllowed = {
  p: ['get,/roles/notAllowed'],
  r: params => {
    return instance.get(`${preUrlPath}/GET/roles/notAllowed`, {params})
  }
}

export {
  request,
  remove,
  notAllowed,
  requestLogin
}
